Utils = require "Utils"
module = {
    index = 1,
    lines = {},
    max_len = 1;
}

function module.to_lines(path)
    file = love.filesystem.newFile(path, "r")
    if file then
        for line in file:lines() do
            module.max_len = module.max_len + 1
            table.insert(module.lines, line)
        end
        file:close()
    end
    Utils.print_table(module.lines)
    
end

function module.nextLine()
    txt = module.lines[module.index]
    if module.index < module.max_len then
        module.index = module.index +1
    end
    return txt
end

function module.splitCommandAndParams(str)
    all = {
        command = "",
        params = {}
    }
    local parts = {}
    for part in string.gmatch(str, "%S+") do
        table.insert(parts, part)
    end
    all.command = parts[1]
    for i = 2, #parts do
        table.insert(all.params, parts[i])
    end
    return all
end
return module